package com.tloss.stdao;

import java.util.Properties;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAResourceBean {
	private static final String PERSISTENCE_UNIT_NAME = "msdao";
	private static EntityManagerFactory emf;

	public static synchronized EntityManagerFactory getEMF() {
		if (emf == null) {
			Properties properties = System.getProperties();
			emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME,
					properties);
		}
		return emf;
	}
}
